//
//  PlayerVideoModel.m
//  TFY_PlayerView
//
//  Created by 田风有 on 2019/6/29.
//  Copyright © 2019 田风有. All rights reserved.
//

#import "PlayerVideoModel.h"

@implementation VideoCommand
-(void)setIds:(NSString *)ids{
    _ids = ids;
}

-(RACCommand *)showCommand{
    if (!_showCommand) {
        _showCommand = [[RACCommand alloc] initWithSignalBlock:^RACSignal * _Nonnull(id  _Nullable input) {
            return [RACSignal createSignal:^RACDisposable * _Nullable(id<RACSubscriber>  _Nonnull subscriber) {
                [TFY_NetWorking getWithUrl:GET_SHOW_KEY refreshCache:NO params:@{@"id":self.ids} success:^(id response) {
                    
                    PlayerVideoModel *video = [PlayerVideoModel tfy_ModelWithJson:response];
                    
                    [subscriber sendNext:video];
                    [subscriber sendCompleted];
                    
                } fail:^(NSError *error) {
                    [subscriber sendNext:nil];
                    [subscriber sendCompleted];
                    [TFY_ProgressHUD showErrorWithStatus:@"数据请求失败!"];
                }];
                return nil;
            }];
        }];
    }
    return _showCommand;
}

@end

@implementation Tags

@end
@implementation Ji

@end
@implementation Zu
+(NSDictionary <NSString *, Class> *)tfy_ModelReplaceContainerElementClassMapper{
    return @{@"ji":[Ji class]};
}
@end
@implementation ViewData
+(NSDictionary <NSString *, Class> *)tfy_ModelReplaceContainerElementClassMapper{
    return @{@"tags":[Tags class],@"zu":[Zu class]};
}
@end
@implementation PlayerVideoModel
+(NSDictionary <NSString *, Class> *)tfy_ModelReplaceContainerElementClassMapper{
    return @{@"data":[ViewData class]};
}
@end
